home *** CD-ROM | disk | FTP | other *** search
- /*
- Copyright © 1991-1995 by TopSoft Inc. All rights reserved.
-
- You may distribute this file under the terms of the TopSoft
- Artistic License, accompanying this package.
-
- This file was developed by George (ty) Tempel in connection with TopSoft, Inc..
- See the Modification History for more details.
-
- Product
- About Box
-
- FILE
- ABStr.c
-
- NAME
- ABStr.c, part of the ABox project source code,
- responsible for handling the AboutBox Str class stuff.
-
- DESCRIPTION
- This file contains defines for the about box modules.
-
- DEVELOPED BY
- George (ty) Tempel netromancr@aol.com
- All code in this file, and its associated header file was
- Created by George (ty) Tempel in connection with the TopSoft, Inc.
- "FilterTop" application development, except where noted.
-
- CARETAKER - George (ty) Tempel <netromancr@aol.com>
- Please consult this person for any changes or suggestions to this file.
-
- MODIFICATION HISTORY
-
- dd mmm yy - xxx - patchxx: description of patch
- 9 June 94 - ty - Initial Version Created
- 20-july-94 - ty - initial version released
- 28-july-94 - ty - 1.0.6--additions to support settable speech mgr usage
- via the ABox Get/SetProperty methods
- 23-may-95 - ty - changes for compatibility with the CodeWarrior CW6
- release and the associated Universal Headers from Apple:
- most methods that returned references now have "Ref" at
- the end of their methods names to prevent possible collisions
- with datatypes and classes of the same name (older versions
- of the compiler didn't have a problem with this).
-
- */
-
- /*===========================================================================*/
-
- /*======= Segmentation directives ========*/
-
- #ifdef USE_MANUAL_SEGMENTATION
- #pragma segment ty
- #endif
-
- /*============ Header files ==============*/
-
- #include "ABStr.h"
- #include "ABox.h"
-
- /*=============== Globals ================*/
-
- /*================ CODE ==================*/
-
-
- /*=============================== ABStr::ABStr ================================*/
- ABStr::ABStr(void)
- {
- mResType = kABStringResource;
- } // end ABStr
-
-
-
- /*=============================== ABStr::~ABStr ================================*/
- ABStr::~ABStr(void)
- {
- } // end ~ABStr
-
-
-
-
-
- /*=============================== ABStr::Draw ================================*/
- OSErr ABStr::Draw(WindowPtr window)
- {
- OSErr error = noErr;
- Rect box;
-
- // begin here...
-
- error = ABObject::Draw(window);
- if (error == noErr)
- {
-
- // get the display area...
- //
- box = this->ObjectRect();
-
- error = this->InitializeResource();
-
- if (this->DoesntHaveResourceHandleRef())
- return noErr;
-
- ::HLockHi (this->ResourceHandleRef());
- if (**(this->ResourceHandleRef()) > 0)
- {
- error = this->DrawTextBox ((unsigned char *)&((*(this->ResourceHandleRef()))[1]), // unsigned char *c
- **(this->ResourceHandleRef()), // unsigned long textSize
- &box, // Rect *displayWrapRect
- teJustCenter, // short alignmentConstants
- 0, // lineHeightCode (0 = default)
- NULL, // short *endY baseline
- NULL); // short *lineHeight
- } // end if block
- ::HUnlock (this->ResourceHandleRef());
-
- }
-
- return error;
-
- } // end Draw
-
-
-
-
- /*=============================== ABStr::Event ================================*/
- Boolean ABStr::Event(EventRecord *event)
- {
- Boolean handled = false;
- Point where;
- OSErr error = noErr;
-
- // begin here...
- //
- if (!event)
- return handled;
-
- switch (event->what)
- {
- case mouseDown:
- // 1.0.6 ty--check to see if we're allowed to use the Text-To-Speech Mgr
- //
- ABox *theABox = (ABox *)::GetWRefCon (this->OurWindowRef());
- Boolean useSpeech = false;
-
- if (theABox)
- error = theABox->GetProperty(kABoxUseSpeechMgr, &useSpeech, NULL);
-
- where = event->where;
- ::GlobalToLocal(&where);
- if (::PtInRect (where, &(this->ObjectRect())) &&
- (::FrontWindow() == this->OurWindowRef()) &&
- ABUEnvSpeechSynth::IsPresent() &&
- useSpeech)
- {
- // Stop speaking first
- error = End();
-
- // speak the string!
- if (this->HasResourceHandleRef())
- {
- ::HLock(this->ResourceHandleRef());
- error = ::SpeakString ((StringPtr)*(this->ResourceHandleRef()));
- ::HUnlock(this->ResourceHandleRef());
- if (!error)
- handled = true;
- } // end if block
- } // end if block
- break;
- default:
- break;
- } // end switch block
-
- return handled;
- } // end Event
-
-
-
- /*=============================== ABStr::Stop ================================*/
- OSErr ABStr::Stop(void)
- {
- OSErr error = noErr;
-
- // begin here...
- //
- error = this->End();
- error = ABResource::Stop();
- return error;
-
- } // end Stop
-
-
-
-
-
-
-
- // end of file
-
-